package edu.neusoft.yuejian_09.model;

import edu.neusoft.yuejian_09.base.Constant;
import edu.neusoft.yuejian_09.base.RetrofitBaseModel;
import edu.neusoft.yuejian_09.base.RetrofitListener;
import edu.neusoft.yuejian_09.bean.Collection;
import edu.neusoft.yuejian_09.service.CollectService;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

import static edu.neusoft.yuejian_09.base.Constant.BASE_URL;

/**
 * Created by 爽 on 2017/11/1.
 */

public class CollectModel extends RetrofitBaseModel {

    public CollectService collectService;
    public CollectModel(){
        this.collectService=retrofit.create(CollectService.class);
    }
    private void service(){
        collectService = retrofit.create(CollectService.class);
    }

    //判断是否收藏
    public void isCollected(int user_id, int id, int flag, final RetrofitListener listener){
        Call call=collectService.isCollect(user_id,id,flag);
        bindCallback(call,listener, Constant.COLLECTSTATE);
    }

    //收藏活动
    public void collectActivity(int user_id,int activity_id , final RetrofitListener listener) {
        Call call = collectService.userCollectActivity(user_id, activity_id);
        bindCallback(call, listener, Constant.COLLECTACTIVITY);
    }

    //收藏比赛
    public void collectContest(int user_id,int contest_id , final RetrofitListener listener) {
        Call call = collectService.userCollectContest(user_id, contest_id);
        bindCallback(call, listener, Constant.COLLECTCONTEST);
    }

    //收藏大师
    public void collectMaster(int user_id,int master_id , final RetrofitListener listener) {
        Call call = collectService.userCollectMaster(user_id, master_id);
        bindCallback(call, listener, Constant.COLLECTMASTER);
    }

    //收藏用户
    public void collectUser(int user_id,int usered_id, final RetrofitListener listener) {
        Call call = collectService.userCollectUser(user_id, usered_id);
        bindCallback(call, listener, Constant.COLLECTUSER);
    }
}
